package com.lupan.guice.bindings.JITBuilding;

import com.google.inject.Inject;
import com.lupan.guice.bindings.CreditCardProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 说明:
 *
 * @author lupan
 * @version 2016/9/19 0019 下午 10:14
 */
public class BillingService {

    private static final Logger logger = LoggerFactory.getLogger(BillingService.class);

    @Inject
    private CreditCardProcessor processor;
    @Inject
    private TransactionLog log;

//    @Inject
//    public BillingService(CreditCardProcessor processor, TransactionLog log) {
//        this.processor = processor;
//        this.log = log;
//    }

    public void charge(){
        logger.info("{}",processor.charge());
        logger.info("{}",log.log());
    }

    public CreditCardProcessor getProcessor() {
        return processor;
    }

    public void setProcessor(CreditCardProcessor processor) {
        this.processor = processor;
    }

    public TransactionLog getLog() {
        return log;
    }

    public void setLog(TransactionLog log) {
        this.log = log;
    }
}
